import { defHttp } from "@/utils/http/Request";



/** 查询用户信息 */
const FetchUserInfo = (): Promise<UserInfo> => {
    return new Promise((resolve, reject) => {
        defHttp.get('/admin/user/get_userinfo')
            .then(res => {
                resolve(res.data);
            })
            .catch(() => {
                reject("查询用户信息失败！")
            })
    })
}


const Login = (values: LoginFormType): Promise<string> => {
    return new Promise((resolve, reject) => {
        defHttp.post('/admin/user/login', values)
            .then(res => {
                if (res.code === 0) {
                    resolve(res.data)
                } else {
                    reject(res.message)
                }

            })
    })


}


export {
    FetchUserInfo,
    Login,
}